class Player {
    var name = "jack"
    var kk = "kk"
    get() = field.capitalize()
    set(value) {
        field = value.trim() //trim去除前后空格
    }
}

fun main() {
    val player = Player()
    println(player.name)
    //player.name会调用set方法
    player.name = " rose "
    println(player.name)
}